#parse argument

architecture=$1
matrix_decompressed_file=$2
matrix_comp_file=$3
output_dir=$4
lorem_ipsum_file=$5

permutation_str=""

# make checksums

str="
xrnlib-cli \
    --make-checksum -plain-text $lorem_ipsum_file -checksum-text $output_dir/checksum.xf
"
echo ""; echo $str; echo ""
eval $str

# check checksums

str="
xrnlib-cli \
    --logging-conf -lib-info-log $output_dir/lib_info_log_file.xf \
    --check-checksum -plain-text $lorem_ipsum_file -checksum-text $output_dir/checksum.xf
"
echo ""; echo $str; echo ""
eval $str

str=" 
if ! [ -s $output_dir/lib_info_log_file.xf ]; then echo FAIL ; exit ; fi ; \
if grep -q FAIL \"$output_dir/lib_info_log_file.xf\" ; then echo FAIL ; exit ; fi
"
echo ""; echo $str; echo ""
eval $str

# generate wrong file

str=" 
cp $lorem_ipsum_file $output_dir/wrong_lorem_ipsum ; echo "a" >> $output_dir/wrong_lorem_ipsum ;
"
echo ""; echo $str; echo ""
eval $str

# check checksums

str="
xrnlib-cli \
    --logging-conf -lib-info-log $output_dir/wrong_lib_info_log_file.xf \
    --check-checksum -plain-text $output_dir/wrong_lorem_ipsum -checksum-text $output_dir/checksum.xf
"
echo ""; echo $str; echo ""
eval $str

str=" 
if ! [ -s $output_dir/wrong_lib_info_log_file.xf ]; then echo FAIL ; exit ; fi ; \
if grep -q PASS \"$output_dir/wrong_lib_info_log_file.xf\" ; then echo FAIL ; exit ; fi
"
echo ""; echo $str; echo ""
eval $str




